<template>
	<view class="mine">
		<view class="head">
			<view>
				<up-avatar class="headImg" mode="aspectFill" @click="goTo('/pages/mine/setUp')"
					:src="UserInfoObj.picture" size="80">
				</up-avatar>
				<view>
					<view>{{ UserInfoObj.nick_name }} <text>VIP{{ UserMoneyObj.project_id || 0 }}</text> </view>
					<view>{{ $t('mine.invite_code') }}：{{ UserInfoObj.id_no }}</view>
				</view>
			</view>
			<image @click="goTo('/pages/mine/setUp')" src="@/static/image/39.png" mode="widthFix" />
		</view>
		<view class="title">{{ $t('mine.my_assets') }}</view>
		<view class="totalAssets">
			<view>
				<view>
					<view>{{ $t('mine.total_assets') }}(USDT)</view>
					<view>
						{{ (UserMoneyObj.balance_quantify + UserMoneyObj.balance_wisdom + UserMoneyObj.balance) || 0 }}
					</view>
				</view>
				<view>
					<view @click="goTo('/pages/index/rechargeList')">{{ $t('mine.recharge') }}</view>
					<view @click="goTo('/pages/index/withdrawal')">{{ $t('mine.withdraw') }}</view>
					<view @click="goTo('/pages/index/bill')">{{ $t('mine.details') }}</view>
				</view>
			</view>

			<view class="balance">
				<view>
					<view>
						<view>{{ UserMoneyObj.balance_quantify || 0 }}</view>
						<view>{{ $t('mine.quantification_account') }}(USDT)</view>
					</view>
					<view>
						<view>{{ UserMoneyObj.balance_wisdom || 0 }}</view>
						<view>{{ $t('mine.wisdom_account') }}(USDT)</view>
					</view>
					<view>
						<view>{{ UserMoneyObj.balance || 0 }}</view>
						<view>
							<image src="@/static/image/31.png" mode="widthFix" />{{ $t('mine.profit_assets') }}(USDT)
						</view>
					</view>
				</view>
			</view>
		</view>

		<view class="title">{{ $t('mine.my_income') }}</view>
		<view class="totalAssets">
			<view>
				<view>
					<view>{{ $t('mine.total_income') }}</view>
					<view>{{ UserStatisticsObj.total_income || 0 }}</view>
				</view>
			</view>
			<view>
				<view>
					<view>
						<view>{{ UserStatisticsObj.total_quantify_income || 0 }}</view>
						<view>{{ $t('mine.today_income') }}</view>
					</view>
					<view>
						<view>{{ UserStatisticsObj.yesterday_income || 0 }}</view>
						<view>{{ $t('mine.yesterday_income') }}</view>
					</view>
					<view>
						<view>{{ UserStatisticsObj.total_recharge || 0 }}</view>
						<view>{{ $t('mine.recharge_amount') }}</view>
					</view>
				</view>
			</view>
		</view>

		<!-- <view class="title">{{ $t('mine.lower_level_invitation') }}</view>
		<view class="lowerLevelInvitation">
			<view v-for="(item, idx) in 3" :key="idx">
				<view>
					<view>{{ $t('mine.level') }}{{ item }}</view>
					<view>
						<view>
							<view>{{ $t('mine.all_and_effective') }}</view>
							<view>0/0</view>
						</view>
						<view>
							<view>{{ $t('mine.earn_commission') }}</view>
							<view>0</view>
						</view>
					</view>
				</view>
			</view>
		</view> -->
		<view class="title">{{ $t('mine.my_service') }}</view>
		<view class="myService">
			<view @click="goTo('/pages/mine/securityCenter')">
				<image src="@/static/image/41.png" mode="widthFix" />{{ $t('mine.security_center') }}
			</view>
			<view @click="goTo('/pages/mine/transfer')">
				<image src="@/static/image/42.png" mode="widthFix" />{{ $t('mine.transfer') }}
			</view>
			<view @click="goTo('/pages/quantification/quantitativeTutorial')">
				<image src="@/static/image/43.png" mode="widthFix" />{{ $t('mine.quantitative_tutorial') }}
			</view>
			<view @click="goTo('/pages/mine/message')">
				<image src="@/static/image/44.png" mode="widthFix" />{{ $t('mine.message') }}
			</view>
			<view @click="goTo('/pages/notLoggedIn/lang')">
				<image src="@/static/image/45.png" mode="widthFix" />{{ $t('mine.language_setting') }}
			</view>
			<view @click="goTo('/pages/mine/questions')">
				<image src="@/static/image/46.png" mode="widthFix" />{{ $t('mine.common_questions') }}
			</view>
			<view @click="goTo('/pages/mine/about')">
				<image src="@/static/image/47.png" mode="widthFix" />{{ $t('mine.about_us') }}
			</view>
			<view @click="goTo('/pages/index/download')">
				<image src="@/static/image/48.png" mode="widthFix" />{{ $t('mine.download_app') }}
			</view>
		</view>
		<customerService />
	</view>
</template>

<script setup lang="ts">
	import { ref, getCurrentInstance } from "vue";
	import { onShow } from "@dcloudio/uni-app";
	const instance = getCurrentInstance()?.appContext.config.globalProperties;
	import { UserMoney, UserInfo, UserStatistics } from "@/api/UserApi";
	import { QuantifySettlementSelect } from "@/api/ProjectApi";

	let UserMoneyObj = ref<any>({})
	let UserInfoObj = ref<any>({})
	let quantifyInfo = ref<any>({})
	let UserStatisticsObj = ref<any>({})
	const initFn = () => {
		UserInfoObj.value = uni.getStorageSync("userInfo");
		UserMoneyObj.value = uni.getStorageSync("UserMoney");
		UserStatisticsObj.value = uni.getStorageSync("UserStatistics");
		QuantifySettlementSelect().then((e) => {
			quantifyInfo.value = e
		})
	}
	onShow(async () => {
		instance?.$changeLanguage()
		initFn()
		await UserMoney()
		await UserInfo()
		await UserStatistics()
		initFn()

	})
</script>
<style scoped lang="scss">
	@import "../../static/scss/mine.scss";
</style>